/*     */ package dm.jdbc.driver;
/*     */ 
/*     */ import dm.jdbc.dataConvertion.Convertion;
/*     */ import dm.jdbc.dbaccess.DBError;
/*     */ import dm.jdbc.desc.LobDesc;
/*     */ import java.sql.SQLException;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class DmdbLob
/*     */   implements Cloneable
/*     */ {
/*     */   DmdbConnection_bs m_conn;
/*     */   public byte[] m_value;
/*  33 */   private DmdbLobLocator m_lobLocator = null;
/*     */   private LobDesc m_lobDesc;
/*  35 */   private byte m_lobFlag = 0;
/*     */   
/*  37 */   private long m_rowid = 0L;
/*     */   
/*  39 */   boolean fromRowSetFlag = false;
/*     */   
/*  41 */   boolean isUpdated = false;
/*     */   
/*  43 */   long offRowLen = -1L;
/*     */   
/*  45 */   boolean m_isFreed = false;
/*  46 */   boolean paramFlag = false;
/*  47 */   boolean m_updatAble = true;
/*  48 */   int m_hdr_size = 13;
/*     */   int m_lobMode;
/*     */   
/*     */   public DmdbLob(byte[] bs, DmdbConnection_bs conn) {
/*  52 */     this.fromRowSetFlag = true;
/*  53 */     this.m_conn = conn;
/*  54 */     this.m_hdr_size = nblob_inrow_hdr_size(conn.getNewLobFlag());
/*     */     
/*  56 */     if ((bs == null) || (bs.length <= 0)) {
/*  57 */       this.m_value = new byte[this.m_hdr_size];
/*  58 */       this.m_value[0] = 1;
/*  59 */       Convertion.setInt(this.m_value, 9, 0);
/*     */     } else {
/*  61 */       this.m_value = new byte[this.m_hdr_size + bs.length];
/*  62 */       this.m_value[0] = 1;
/*  63 */       Convertion.setInt(this.m_value, 9, bs.length);
/*  64 */       System.arraycopy(bs, 0, this.m_value, this.m_hdr_size, bs.length);
/*     */     }
/*  66 */     this.m_lobMode = conn.getLobMode();
/*     */   }
/*     */   
/*     */   protected DmdbLob(byte[] value, byte lobFlag, LobDesc lobDesc, DmdbConnection_bs conn, boolean updAble)
/*     */   {
/*  71 */     this.m_conn = conn;
/*  72 */     this.m_value = value;
/*  73 */     this.m_updatAble = updAble;
/*  74 */     this.m_lobDesc = lobDesc;
/*  75 */     this.m_lobMode = lobDesc.getLobMode();
/*  76 */     this.m_lobFlag = lobFlag;
/*     */     
/*  78 */     this.m_hdr_size = nblob_inrow_hdr_size(conn.getNewLobFlag());
/*     */     
/*  80 */     getLobLocator();
/*     */   }
/*     */   
/*     */   protected void setConnection(DmdbConnection_bs conn) {
/*  84 */     this.m_conn = conn;
/*  85 */     this.m_hdr_size = nblob_inrow_hdr_size(conn.getNewLobFlag());
/*     */   }
/*     */   
/*     */   protected DmdbLobLocator getLobLocator() {
/*  89 */     if ((this.m_lobLocator == null) || (!this.m_lobLocator.IsFilled())) {
/*  90 */       this.m_lobLocator = new DmdbLobLocator(this.m_value, this.m_lobFlag, this.m_lobDesc, 
/*  91 */         this.m_conn.getNewLobFlag());
/*     */     }
/*  93 */     return this.m_lobLocator;
/*     */   }
/*     */   
/*     */   public long getRowId() {
/*  97 */     return this.m_rowid;
/*     */   }
/*     */   
/*     */   public boolean isValueInRow() {
/* 101 */     if (this.m_value[0] == 2) {
/* 102 */       return false;
/*     */     }
/* 104 */     return true;
/*     */   }
/*     */   
/*     */   public int getLobLen() {
/* 108 */     return Convertion.getInt(this.m_value, 9);
/*     */   }
/*     */   
/*     */ 
/*     */   protected byte[] getValueInRow()
/*     */     throws SQLException
/*     */   {
/* 115 */     int len = Convertion.getInt(this.m_value, 9);
/* 116 */     byte[] val = new byte[len];
/* 117 */     System.arraycopy(this.m_value, this.m_hdr_size, val, 0, len);
/* 118 */     return val;
/*     */   }
/*     */   
/*     */   public Object clone() {
/* 122 */     DmdbLob lob = null;
/*     */     try {
/* 124 */       lob = (DmdbLob)super.clone();
/* 125 */       if (this.m_value != null) {
/* 126 */         lob.m_value = ((byte[])this.m_value.clone());
/*     */       }
/*     */     } catch (CloneNotSupportedException e) {
/* 129 */       e.printStackTrace();
/*     */     }
/*     */     
/* 132 */     return lob;
/*     */   }
/*     */   
/*     */   public void setCurToHead() {
/* 136 */     if (this.m_lobLocator != null)
/* 137 */       this.m_lobLocator.setCurToHead();
/*     */   }
/*     */   
/*     */   public DmdbConnection_bs getConnection() {
/* 141 */     return this.m_conn;
/*     */   }
/*     */   
/*     */   void free() throws SQLException {
/* 145 */     if (this.m_isFreed) {
/* 146 */       return;
/*     */     }
/* 148 */     if (this.m_conn != null)
/* 149 */       this.m_conn = null;
/* 150 */     if (this.m_value != null) {
/* 151 */       this.m_value = null;
/*     */     }
/* 153 */     this.m_isFreed = true;
/*     */   }
/*     */   
/*     */   void checkFreed() throws SQLException {
/* 157 */     if (this.m_isFreed)
/* 158 */       DBError.throwSQLException(20003);
/*     */   }
/*     */   
/*     */   public int nblob_inrow_hdr_size(boolean new_flag) {
/* 162 */     if (new_flag) {
/* 163 */       return 43;
/*     */     }
/* 165 */     return 13;
/*     */   }
/*     */   
/*     */   void checkConnClosed() throws SQLException {
/* 169 */     if ((this.m_conn == null) || (this.m_conn.closed))
/*     */     {
/* 171 */       DBError.throwSQLException(6060);
/*     */     }
/*     */   }
/*     */ }


/* Location:              D:\Program Files\DBMS_20150813\jdbc\Dm7JdbcDriver17.jar!\dm\jdbc\driver\DmdbLob.class
 * Java compiler version: 2 (46.0)
 * JD-Core Version:       0.7.1
 */